<?php $this->headTitle('Управление тегами'); ?>

<div id="strlist">
    <div class="strecord">
        <div class="theme">Управление тегами</div>
        <?php if (!empty($this->messages)) { ?>
        <div class="messages">
            <?php foreach($this->messages as $message) {
                    echo $message . '<br>';
                } ?>
        </div>
        <?php } ?>
        <table>
        <tr>
        <th>Метка</th>
        <th>Количество</th>
        <th></th>
        <th></th>
        </tr>
        <?php $classTr = 'odd';
        foreach ($this->paginator as $tag)
        { ?>
        <tr class="<?php echo $classTr ?>">
        <td><?php echo $tag->name; ?></td>
        <td><?php echo $tag->count; ?></td>
        <td><a href="<?php echo $this->url(array('module' => 'aria77',
                                                 'controller' => 'tag',
                                                 'action' => 'edit',
                                                 'id' => $tag->tag_id),
                                               'editTag') ?>">Edit</a></td>
        <?php if ($tag->count == 0) : ?>
        <td><a href="<?php echo $this->url(array('module' => 'aria77',
                                                 'controller' => 'tag',
                                                 'action' => 'delete',
                                                 'id' => $tag->tag_id),
                                           'deleteTag') ?>">Delete</a></td>
        <?php else : ?>
        <td>Delete</td>
        <?php endif; ?>
        </tr>
            
        <?php
            $classTr = ($classTr == 'odd') ? 'even' : 'odd';
        } ?>
        </table>
        <p><a href="<?php echo $this->url(array('module' => 'aria77',
                                                'controller' => 'tag',
                                                'action' => 'add'),
                               'addTag'); ?>" class="button">Создать тег</a></p>
    </div>
    <?php echo $this->paginationControl($this->paginator, 'Elastic', 'main_paginator.phtml'); ?>
</div>
